package me.ywd.poker.main;

import me.ywd.poker.entity.Hand;
import me.ywd.poker.entity.Poker;
import me.ywd.poker.generator.HandsGenerator;

import java.text.DecimalFormat;
import java.util.List;

/**
 * Created by AOC3 on 2017/2/23.
 */
public class InfoOutput {
    private static HandsGenerator generator = new HandsGenerator();
    public static void main(String[] args) {
        List<Poker> pokers = generator.generateAllPokers();

        System.out.println(pokers.size());
        for (Poker poker : pokers) {
            // System.out.println(poker);
        }

        Poker poker = new Poker("Ad");
        System.out.println(poker);

        List<Hand> allHands = generator.generateAllHands();
        System.out.println(allHands.size());
        for (int i = 0; i < allHands.size(); i++) {
//            Hand hand = allHands.get(i);
//            if (i % 10 == 0) System.out.println();
//            System.out.print(hand + "  ");
        }

        String[] formats = {
                "AA", "KK", "QQ", "JJ", "TT", "99", "88", "77", "66", "55", "44", "33", "22"
                ,"A"
                ,"KQ", "KJ", "QJ", "JT", "T9", "Q9"
                ,"KTs", "QTs", "Q9s", "J9s", "K9s", "J8s", "T8s", "T7s", "97s", "86s", "75s", "K8s", "Q8s", "K7s"
                ,"98s", "87s", "76s", "65s", "54s", "43s", "32s"
                , "96s"
        };
        String[] excludedFormats = {

        };
        int count = 0;
        for (Hand hand : allHands) {
            for (String format : formats) {
                if (hand.isFormat(format)) {
                    count++;
                    break;
                }
            }
        }
        DecimalFormat df = new DecimalFormat("#.##");
        double size = allHands.size();
        String odds = df.format(count / size);
        String denominator = df.format(1 / (count / size));
        System.out.println(count + " / " + allHands.size() + " = " + odds + "   ( 1/" + denominator + " )");
    }
}
